using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace System.IPod.Music
{
	public class AlbumItem : Node
	{
		string m_albumTitle;
		string m_artistName;
		internal Mhia m_mhia;
		
		//protected override int Size
		//{
		//    get { return m_mhia.HeaderLength; }
		//}

		protected override void ReadImpl(BinaryReader reader)
		{
			m_mhia = new Mhia();
			m_mhia.Read(reader);

			for (int j = 0; j < m_mhia.StringCount; j++)
			{
				DataObject dataObj = new DataObject();
				AddChild(dataObj);
				dataObj.Read(reader);

				if (dataObj.Type < 15)
				{
					DataString dataString = new DataString();
					dataObj.AddChild(dataString);
					dataString.Read(reader);
				}
				else
				{
					DataBlob dataBlob = new DataBlob();
					dataObj.AddChild(dataBlob);
					dataBlob.Read(reader);
				}
			}
		}

		protected override void WriteImpl(BinaryWriter writer)
		{
			m_mhia.Write(writer);
		}

		protected override void SetSize(int size)
		{
			m_mhia.TotalLength = size;
		}
	}
}
